package com.niit.controller;

import com.niit.entity.Student;
import com.niit.mapper.StudentMapper;
import com.niit.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

public class TestUpdateBySid {
    public static void main(String[] args) {

        SqlSession sqlSession = MybatisUtil.getSqlSession();
        StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);

        Student student = new Student();
        student.setSname("张三");
        student.setSid("2020204646");

        int result = studentMapper.updateStudent(student);
        // 提交事务
        sqlSession.commit();

        if (result > 0){
            System.out.println("修改成功");
        }
    }
}
